home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 21
/
Cream of the Crop 21 (Terry Blount) (October 1996).iso
/
educate
/
wordy442.zip
/
TOUPPER.C
< prev
next >
Wrap
C/C++ Source or Header
|
1996-01-28
|
916b
|
53 lines
#include <stdio.h>
#include <string.h>
#define MAXFILENAMELEN 40
#define MAXLEN 60
void convert( char *file_name );
void main( int argc, char **argv )
{
char filename [MAXFILENAMELEN];
if( argc != 2 )
{
printf( "\n\nFilename to convert to upper case? " );
gets( filename );
}
else
strcpy( filename, *( argv + 1 ) );
convert( filename );
}
void convert( char *fname )
{
char word [MAXLEN];
FILE *fps,
*fpt;
fps = fopen( fname, "r" );
fpt = fopen( "tfile", "w" );
while( !feof( fps ) )
{
fgets( word, MAXLEN - 1, fps );
if( feof( fps ) ) break;
strupr( word );
fputs( word, fpt );
}
fclose( fps );
fclose (fpt );
unlink( fname );
rename( "tfile", fname );
return;
}